#include <stdio.h>
int main() {
  int n, k, a[50], count = 0;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  for (int i = 0; i < n; i++) count += a[i] >= a[k - 1] && a[i] > 0 ? 1 : 0;
  printf("%d\n", count);
  return 0;
}